package com.itms.tool.data;

import java.util.Date;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable
public class Image {

	@DatabaseField(generatedId = true)
	private int id;
	@DatabaseField
	private String path;
	@DatabaseField
	private Date dateTaken;
	@DatabaseField(foreign = true, foreignAutoRefresh = true)
	private Object object;
	@DatabaseField
	private boolean selected;

	public Image() {
		// for ormlite
	}

	public Image(String path, Date dateTaken, Object object) {
		this.path = path;
		this.dateTaken = dateTaken;
		this.object = object;
	}

	public int getId() {
		return id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Date getDateTaken() {
		return dateTaken;
	}

	public void setDateTaken(Date dateTaken) {
		this.dateTaken = dateTaken;
	}

	public Object getObject() {
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	}

	public boolean isSelected() {
		return selected;
	}

	public void setSelected(boolean selected) {
		this.selected = selected;
	}

	@Override
	public int hashCode() {
		int hash = path != null ? path.hashCode() : 0;
		hash += 31 * id;
		return hash;
	}

	@Override
	public boolean equals(java.lang.Object o) {
		if (!(o instanceof Image)) {
			return false;
		}
		Image other = (Image) o;
		return id == other.id
				&& (path == null ? other.path == null : path == other.path);
	}

	@Override
	public String toString() {
		return "Image[id=" + id + ",path=" + path + ",dateTaken=" + dateTaken
				+ ",objet=" + object + "]";
	}
}
